package thread;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;

/**
 * @Author pedant
 * @Date 2019/8/30 17:53
 * @Description 创建线程的方式
 */
public class PoolTest {
    private static ExecutorService executor = Executors.newSingleThreadExecutor();

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Future<String> submit = executor.submit(() -> Thread.currentThread().getName() + "线程启动");
        System.out.println(submit.get());
    }
}
